/* GUI CONVERTED from rccadju2.p (converter v1.75) Tue Apr 10 12:03:25 2001 */
/* rccadju2.p - CUSTOMER SCHEDULES - CREATE TR_HIST IN SHIPFROM DB            */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.5.1.3 $                                                           */
/*V8:ConvertMode=Maintenance                                                  */
/* REVISION: 7.3    LAST MODIFIED: 08/25/95           BY: bcm *G0TB*          */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 11/25/99   BY: *K24G* Kedar Deherkar     */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* $Revision: 1.5.1.3 $    BY: Jean Miller    DATE: 03/22/01 ECO: *P008*          */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/
/* CUM SHIP ADJUSTMENT UPDATE SHIP-FROM DATABASE tr_hist RECORDS */

{mfdeclre.i}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rccadju2_p_1 "A/R"
/* MaxLen: Comment: */

&SCOPED-DEFINE rccadju2_p_2 "Adjust or Reset (A/R)"
/* MaxLen: Comment: */

&SCOPED-DEFINE rccadju2_p_3 "Remarks"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

define input parameter sod-nbr     like sod_nbr.
define input parameter sod-line    like sod_line.
define input parameter adj_type    like mfc_logical format {&rccadju2_p_1}
                                   label {&rccadju2_p_2}.
define input parameter remarks     as  character format "x(24)"
                                   label {&rccadju2_p_3}.
define input parameter adjust      as  logical.
define input parameter cust        like so_cust.
define input parameter pri-cum-qty as   decimal.

/* FIND THE SO DETAIL RECORD */
find sod_det where
     sod_nbr  = sod-nbr and
     sod_line = sod-line
exclusive-lock.

/* CREATE AND UPDATE TRANSACTION HISTORY */
create tr_hist.
assign
   tr_date      = today
   tr_effdate   = today
   tr_part      = sod_part
   tr_type      = if adj_type = adjust then "CUM-SADJ" else "CUM-SRES"
   tr_nbr       = sod_nbr
   tr_line      = sod_line
   tr_so_job    = sod_nbr
   tr_site     = sod_site
   tr_addr      = cust
   tr_program   = execname
   tr_time      = time
   tr_loc_begin = sod_cum_qty[1]
   tr_rmks      = remarks
   tr_userid    = global_userid
   tr_qty_chg   = sod_cum_qty[1] - pri-cum-qty.
if recid(tr_hist) = -1 then .

/* ASSIGN TRANSACTION NUMBER TO TR_HIST */
{mfntran.i}
